(function($, owner) {
	owner.initRefresh = function(idname, refreshFun, loadingMsg, loadEndMsg) {
		loadingMsg = loadingMsg ? loadingMsg : '正在加载...';
		loadEndMsg = loadEndMsg ? loadEndMsg : '没有更多数据了';
		$.init({
			pullRefresh: {
				container: idname,
				up: {
					contentrefresh: loadingMsg,
					contentnomore: loadEndMsg,
					callback: refreshFun
				}
			}
		});
		if($.os.plus) {
			$.plusReady(function() {
				setTimeout(function() {
					$(idname).pullRefresh().pullupLoading();
				}, 1000);

			});
		} else {
			$.ready(function() {
				$(idname).pullRefresh().pullupLoading();
			});
		}
	},
	owner.ajaxGetData = function(url, type, data, callback, params) {
		data = data ? data : [];
		type = type ? type : 'GET'; //默认类型为GET
		params = params ? params : '';
		$.ajax(url, {
			data: data,
			dataType: 'json', //服务器返回json格式数据
			type: type, //HTTP请求类型
			timeout: 10000, //超时时间设置为10秒；
			async: true, //异步设为true
			success: function(data) {
				callback(data, params);
			},
			error: function(xhr, type, errorThrown) {
				//异常处理；
			}
		});
	}
}(mui, window.newRefresh = {}))

